package com.mk.domain;

import act.db.DB;
import com.github.d925529.apidoc.annotation.ApiField;
import org.beetl.sql.core.annotatoin.AssignID;
import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.annotatoin.Table;
import org.beetl.sql.core.mapper.BaseMapper;

import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 说明：购物车
 * 作者：anonymous
 * 日期：2018-10-25 15:0:13
 * 版本：1.0.0
 */
@Table(name = "t_cart")
@SuppressWarnings("unused")
public class TCart implements Serializable {
    @AssignID
    //购物车ID
    @ApiField("购物车ID")
    private String cartid;
    
    //购买者ID
    @ApiField("购买者ID")
    private String mid;
    
    //品牌id
    @ApiField("品牌id")
    private String brid;
    
    //产品ID
    @ApiField("产品ID")
    private String pdid;
    
    //psid
    @ApiField("psid")
    private String psid;
    
    //购物车数量
    @ApiField("购物车数量")
    private Integer cartnumber;
    
    //加入购物车时间
    @ApiField("加入购物车时间")
    private String cartdate;

    @ApiField("折扣")
    @Transient
    private BigDecimal discount;

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    /**
     * @return 购物车ID
     */
    public String getCartid(){
        return cartid;
    }
    /**
     * @param cartid 购物车ID
     */
    public void setCartid(String cartid){
        this.cartid = cartid;
    }
    
    /**
     * @return 购买者ID
     */
    public String getMid(){
        return mid;
    }
    /**
     * @param mid 购买者ID
     */
    public void setMid(String mid){
        this.mid = mid;
    }
    
    /**
     * @return 品牌id
     */
    public String getBrid(){
        return brid;
    }
    /**
     * @param brid 品牌id
     */
    public void setBrid(String brid){
        this.brid = brid;
    }
    
    /**
     * @return 产品ID
     */
    public String getPdid(){
        return pdid;
    }
    /**
     * @param pdid 产品ID
     */
    public void setPdid(String pdid){
        this.pdid = pdid;
    }
    
    /**
     * @return psid
     */
    public String getPsid(){
        return psid;
    }
    /**
     * @param psid psid
     */
    public void setPsid(String psid){
        this.psid = psid;
    }
    
    /**
     * @return 购物车数量
     */
    public Integer getCartnumber(){
        return cartnumber;
    }
    /**
     * @param cartnumber 购物车数量
     */
    public void setCartnumber(Integer cartnumber){
        this.cartnumber = cartnumber;
    }
    
    /**
     * @return 加入购物车时间
     */
    public String getCartdate(){
        return cartdate;
    }
    /**
     * @param cartdate 加入购物车时间
     */
    public void setCartdate(String cartdate){
        this.cartdate = cartdate;
    }
    


    public interface Mapper extends BaseMapper<TCart> {
        /**
         * 购物车列表
         *
         * @param mid
         * @return
         */
        List<Map<String,Object>> cartList(@Param("mid")String mid);

        /**
         * 购物车确认订单列表
         * @param mid
         * @param cartids
         * @return
         */
        List<Map<String,Object>> confirmCartList(@Param("mid")String mid,@Param("cartids")List<String> cartids);

        /**
         * 删除购物车中商品
         * @param mid
         * @param cartids
         * @return
         */
        Integer deleteByCartids(@Param("mid")String mid,@Param("cartids")List<String> cartids);


    }
}